package com.itheima.list;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/*
List 特点
存取有序
可重复
有索引
 */
public class Demo01 {

    public static void main(String[] args) {
        List<String> list= new ArrayList<>();
        list.add("aaa");
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        System.out.println(list);
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("===============");
        for (String s : list) {
            System.out.println(s);
        }
        System.out.println("===============");
        list.forEach(s-> System.out.println(s));
        System.out.println("===============");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

    }
}
